PROJECT=ir_sender
SOURCES=ir_sender.c
CC=avr-gcc
OBJCOPY=avr-objcopy
MMCU=attiny25

AVRDUDE=avrdude -p t25 -c stk500v2 -P /dev/avrusb500
# /dev/avrusb500 is a symlink to the actual /dev/ttyUSB* and is done
# using the following rule in /etc/udev/rules.d/10-local.rules :
#
# KERNEL=="ttyUSB*", SYSFS{serial}=="A20008EC", SYMLINK+="avrusb500"
#
 
CFLAGS=-g -Os -mcall-prologues -mmcu=$(MMCU) -Wall
 
$(PROJECT).hex: $(PROJECT).out
	$(OBJCOPY) -j .text -O ihex $(PROJECT).out $(PROJECT).hex
 
$(PROJECT).out: $(SOURCES)
	$(CC) $(CFLAGS) -I./ -o $(PROJECT).out $(SOURCES)
 
clean:
	rm -f $(PROJECT).out
	rm -f $(PROJECT).hex

program: $(PROJECT).hex
	$(AVRDUDE) -U flash:w:$(PROJECT).hex:i

